In [ ]:
# Tuples an immutable list
p = (4,'hello', (1,2,3))
print p
In [ ]:
# List a mutable list
myList = [4,'hello',6]
print '0th value = %d'%myList[0]
myList.append(7)
print 'List Length = %d'%len(myList)
for value in myList:
print value
In [ ]:
# Dictionary an unordered set of key value pairs
myDict = {'p':4,'q':5,'r':(6,5,6), 1: {1: 3, 3: 5}}
print 'P value = %d'%myDict['p']
myDict['p'] = 10
print 'P value = %d'%myDict['p']
print 'Top level dictionary item count = %s'%len(myDict)
print 'Nested dictionary item count = %s'%len(myDict[1])
print 'Keys = %s'%myDict.keys()
print 'Values = %s'%myDict.values()
for key in myDict.keys():
print myDict[key]
In [ ]: